<!DOCTYPE html>
<style>
  body {
    margin: 0;
  }
  iframe {
    height: 900px;
    width: 900px;
    margin-left: 51px;
    margin-top: 52px;
    border: none;
  }
</style>

<script>
  // Prefer non-composited scrolling because this is a test of non-composited
  // scrollers.
  if (window.internals)
    internals.runtimeFlags.preferNonCompositedScrollingEnabled = true;
</script>

<iframe id='iframe' src='resources/iframe-containing-non-fast-scrollables.html'></iframe>

<div id="console"></div>

<script src="../resources/js-test.js"></script>
<script src="resources/non-fast-scrollable-region-testing.js"></script>
<script>
  window.jsTestIsAsync = true;
  description('The test ensures that non-fast scrollable regions nested in ' +
              'iframe are correctly offset by the iframe location.');

  onload = function() {
    nonFastScrollableRects = sortRects([...internals.nonFastScrollableRects(document)]);
    shouldBe('nonFastScrollableRects.length', '2');
    shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[51, 102, 200, 200]');
    shouldBeEqualToString('rectToString(nonFastScrollableRects[1])', '[51, 402, 211, 211]');

    drawNonFastScrollableRegionOverlays();
    finishJSTest();
  };
</script>
